/**
 * gpms
 * 2012-8-22 上午9:24:58
 * 作者：陈志明
 * 
 */
package com.gpms.privilege.dao;

import java.util.List;

import com.gpms.common.dao.BaseDaoSupport;
import com.gpms.mapper.ItemDetails;

/**
 * @author Jackie chen
 *
 */
public class ItemDetailsDao extends BaseDaoSupport {
	
	/**
	 * 根据项目ID查询项目字典
	 * @param user
	 * @return Users
	 */
	public ItemDetails findItemDetailsById(ItemDetails itemDetails){
		return this.getSqlSession().selectOne(itemDetailsMapper+".selectByPrimaryKey",itemDetails.getId());
	}
	
	/**
	 * 根据父项ID查询项目字典
	 * @param parentid
	 * @return
	 */
	public List<ItemDetails> findItemDetailsByParentId(String parentid){
		return this.getSqlSession().selectList(itemDetailsMapper+".selectByParentId",parentid);
	}
	
	/**
	 * 根据资源类别查询项目字典
	 * @param detailstype
	 * @return
	 */
	public List<ItemDetails> findItemDetailsByDetailsType(String detailstype){
		return this.getSqlSession().selectList(itemDetailsMapper+".selectByDetailsType",detailstype);
	}
	
	/**
	 * 保存字典项
	 * @param user
	 * @return
	 */
	public int saveItemDetails(ItemDetails itemDetails){
		return this.getSqlSession().insert(itemDetailsMapper+".insertSelective",itemDetails);
	}
	
	/**
	 * 根据项目ID修改项目字典
	 * @param user
	 * @return
	 */
	public int alterItemDetailsById(ItemDetails itemDetails){
		return this.getSqlSession().update(itemDetailsMapper+".updateByPrimaryKeySelective",itemDetails);
	}
	
	/**
	 * 根据项目ID删除项目字典
	 * @param user
	 * @return
	 */
	public int removeItemDetailsById(ItemDetails itemDetails){
		return this.getSqlSession().delete(itemDetailsMapper+".deleteByPrimaryKey",itemDetails.getId());
	}
}
